package com.enki.cigarettes.repository;

import com.enki.cigarettes.entity.ProductT;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.repository.PagingAndSortingRepository;

/**
 * @author WCS.Wang
 * @version V1.0
 * @Package com.enki.cigarettes.repository
 * @Name e-cigarettes-shop-api-module
 * @Description: TODO 商品信息数据层
 * @date 2019-07-19
 */
public interface ProductTRepository extends PagingAndSortingRepository<ProductT, String> {

    // 分页查询
    Page<ProductT> findAll(Specification specification, Pageable pageable);

    /**
     * 根据商品ID、商品状态
     * @param id
     * @param status
     * @return
     */
    ProductT findOneByIdAndStatus(long id, int status);

    // 详情
    ProductT findOneById(long id);

}
